#!/usr/bin/env bash

VG=app1vg
LV=testlv
SZ=32
USER=test

if [[ "$(whoami)" != root ]]
then
	echo "Error: Test set-up can only be run as root."
	exit 1
fi

if [[ "$(uname)" != Linux ]]
then
	echo "Error: This test is designed for Linux only."
	exit 1
fi

umount /tmpmnt_testing
lvremove --force /dev/$VG/$LV 

lvcreate -L ${SZ}m -n $LV $VG || exit 1

mkfs -t ext4 /dev/$VG/$LV || exit 1

mkdir /tmpmnt_testing 2>/dev/null

mount -t ext4 /dev/$VG/$LV /tmpmnt_testing || exit 1
chown $USER /tmpmnt_testing

exit 0
